package com.zb.zeus.system.api.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.zb.zeus.common.core.constant.UserConstants;
import com.zb.zeus.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * 员工信息对象 t_sys_employee
 * 
 * @author Chenpeng.Huang
 * @date 2021-07-09
 */
@ApiModel(value = "SysEmployee", description = "员工信息对象")
@TableName("t_sys_employee")
public class SysEmployee extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /**
     * 员工-内部员工
     */
    public static final Integer EMP_INNER = 0;
    /**
     * 员工-外部员工
     */
    public static final Integer EMP_NOT_INNER = 1;

    /** 员工号(唯一，兼任现有sap员工号)(from ihr) */
    @ApiModelProperty(value = "员工号(唯一，兼任现有sap员工号)")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long empNum;

    /** 员工AD(OA号)(唯一,不允许修改)(from ihr) */
    @ApiModelProperty(value = "员工AD(OA号)(唯一,不允许修改)")
    private String adNum;

    /** 员工姓名(from ihr) */
    @ApiModelProperty(value = "员工姓名")
    private String empName;

    /** 证件类型 字典值(from ihr) */
    @ApiModelProperty(value = "证件类型 字典值 ")
    private String icType;

    /** 证件号码(不能为空，首位不能有空格，唯一。为身份证时，需要进行合法新校验)(from ihr) */
    @ApiModelProperty(value = "证件号码(不能为空，首位不能有空格，唯一。为身份证时，需要进行合法新校验)")
    private String icNum;

    /** 电话号码(from ihr) */
    @ApiModelProperty(value = "电话号码")
    private String phn;

    /** 邮箱(from ihr) */
    @ApiModelProperty(value = "邮箱")
    private String email;

    /** 性别  字典值[1:男 2：女](from ihr) */
    @ApiModelProperty(value = "性别  字典值[1:男 2：女]")
    private Integer gender;

    /** 生日(from ihr) */
    @ApiModelProperty(value = "生日")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    /** 职级  字典值(from ihr) */
    @ApiModelProperty(value = "职级  字典值")
    private Integer postLv;

    /** 职等  字典值(from ihr) */
    @ApiModelProperty(value = "职等  字典值")
    private Integer postGrade;

    /** 员工状态（1:离职 0：在职）(from ihr) */
    @ApiModelProperty(value = "员工状态（1:离职 0：在职）")
    private Integer empStatus;

    /** 入职日期(from ihr) */
    @ApiModelProperty(value = "入职日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8")
    private Date entryDate;

    /** 离职日期(from ihr) */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8")
    @ApiModelProperty(value = "离职日期")
    private Date regtDate;

    /** 板块id 字典值(from ihr) */
    @ApiModelProperty(value = "板块id 字典值")
    private String plate;

    /** 任职类型（员工组） 字典值(from ihr) */
    @ApiModelProperty(value = "任职类型（员工组） 字典值")
    private String empGroup;

    /** 任职子类型（员工子组） 字典值(from ihr) */
    @ApiModelProperty(value = "任职子类型（员工子组） 字典值")
    private String empSubGroup;

    /** 上级员工号(唯一，直接上级只有一个)(from ihr) */
    @ApiModelProperty(value = "上级员工号(唯一，直接上级只有一个)")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentEmpNum;

    /** 上级ad号(from ihr) */
    @ApiModelProperty(value = "上级ad号")
    private String parentAdNum;

    /** 所属单位编码(from ihr) */
    @ApiModelProperty(value = "所属单位编码")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long unitId;

    /** 所属部门编码(from ihr) */
    @ApiModelProperty(value = "所属部门编码")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long orgId;

    /** 岗位编码(from ihr) */
    @ApiModelProperty(value = "岗位编码")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long postId;

    /** 标准岗位编码(from ihr) */
    @ApiModelProperty(value = "标准岗位编码")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long stdPostId;

    /** 专业序列条线编码 字典值(from ihr) */
    @ApiModelProperty(value = "专业序列条线编码 字典值")
    private Integer postLine;

    /** 中心管理条线 字典值(from ihr) */
    @ApiModelProperty(value = "中心管理条线 字典值")
    private String mgmtLine;

    /** 试用期限 单位(月)(from ihr) */
    @ApiModelProperty(value = "试用期限 单位(月)")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long probation;

    /** 转正日期(from ihr) */
    @ApiModelProperty(value = "转正日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8")
    private Date positiveDate;

    /** 时间戳 */
    @ApiModelProperty(value = "时间戳")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date ts;

    /** 用户类型（00系统用户，NULL或空字符为普通用户） */
    @ApiModelProperty(value = "用户类型（00系统用户 NULL或空字符为普通用户）")
//    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String userType;

    /** 头像地址 */
    @ApiModelProperty(value = "头像地址")
    private String avatar;

    /** 密码 */
    @ApiModelProperty(value = "密码")
    private String password;

    /** 最后登录IP */
    @ApiModelProperty(value = "最后登录IP")
    private String loginIp;

    /** 最后登录时间 */
    @ApiModelProperty(value = "最后登录时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date loginDate;

    /** 部门对象 */
    @ApiModelProperty(value = "部门对象")
    @TableField(exist = false)
    private SysOrg org;

    /** 角色对象 */
    @ApiModelProperty(value = "角色对象")
    @TableField(exist = false)
    private List<SysRole> roles;

    /** 角色组 */
    @ApiModelProperty(value = "角色组")
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long[] roleIds;

    /** 岗位组 */
    @ApiModelProperty(value = "岗位组")
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long[] postIds;

    /** 角色ID */
    @ApiModelProperty(value = "角色ID")
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long roleId;

    /**
     * 消息id
     */
    @TableField("msg_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long msgId;

    /**
     * 0：有效 1：无效
     */
    @TableField("`status`")
    private Integer status;

    @TableField("`inner`")
    private Integer inner;

    /**
     * 组织对象
     */
    @ApiModelProperty(value = "组织对象ID")
    @TableField(exist = false)
    private Set<String> orgBusinessIds;

    /**
     * ad号列表
     */
    @TableField(exist = false)
    private List<String> adNumList;

    /**
     * 姓名列表
     */
    @TableField(exist = false)
    private List<String> nameList;

    /**
     * 身份证列表
     */
    @TableField(exist = false)
    private List<String> icNumList;

    public SysEmployee() {

    }

    public SysEmployee(Long id) {
        this.setId(id);
    }

    public boolean isAdmin()
    {
        return UserConstants.ADMIN_USER_TYPE.equals(userType);
//        return isAdmin(this.getId());
    }

//    public static boolean isAdmin(Long id)
//    {
//        return id != null && 1L == id;
//    }

    public void setEmpNum(Long empNum) 
    {
        this.empNum = empNum;
    }

    public Long getEmpNum() 
    {
        return empNum;
    }
    public void setAdNum(String adNum) 
    {
        this.adNum = adNum;
    }

//    @Size(min = 0, max = 64, message = "员工AD号长度不能超过64个字符")
    public String getAdNum() 
    {
        return adNum;
    }
    public void setEmpName(String empName) 
    {
        this.empName = empName;
    }

    @Size(min = 0, max = 64, message = "员工姓名长度不能超过64个字符")
    public String getEmpName() 
    {
        return empName;
    }
    public void setIcType(String icType) 
    {
        this.icType = icType;
    }

    public String getIcType() 
    {
        return icType;
    }
    public void setIcNum(String icNum) 
    {
        this.icNum = icNum;
    }

    public String getIcNum() 
    {
        return icNum;
    }
    public void setPhn(String phn) 
    {
        this.phn = phn;
    }

    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
    public String getPhn() 
    {
        return phn;
    }
    public void setEmail(String email) 
    {
        this.email = email;
    }

    public String getEmail() 
    {
        return email;
    }
    public void setGender(Integer gender) 
    {
        this.gender = gender;
    }

    public Integer getGender()
    {
        return gender;
    }
    public void setBirthday(Date birthday) 
    {
        this.birthday = birthday;
    }

    public Date getBirthday() 
    {
        return birthday;
    }
    public void setPostLv(Integer postLv)
    {
        this.postLv = postLv;
    }

    public Integer getPostLv()
    {
        return postLv;
    }
    public void setPostGrade(Integer postGrade)
    {
        this.postGrade = postGrade;
    }

    public Integer getPostGrade()
    {
        return postGrade;
    }
    public void setEmpStatus(Integer empStatus)
    {
        this.empStatus = empStatus;
    }

    public Integer getEmpStatus()
    {
        return empStatus;
    }
    public void setEntryDate(Date entryDate) 
    {
        this.entryDate = entryDate;
    }

    public Date getEntryDate() 
    {
        return entryDate;
    }
    public void setRegtDate(Date regtDate) 
    {
        this.regtDate = regtDate;
    }

    public Date getRegtDate() 
    {
        return regtDate;
    }
    public void setPlate(String plate) 
    {
        this.plate = plate;
    }

    public String getPlate() 
    {
        return plate;
    }
    public void setEmpGroup(String empGroup) 
    {
        this.empGroup = empGroup;
    }

    public String getEmpGroup() 
    {
        return empGroup;
    }
    public void setEmpSubGroup(String empSubGroup) 
    {
        this.empSubGroup = empSubGroup;
    }

    public String getEmpSubGroup() 
    {
        return empSubGroup;
    }
    public void setParentEmpNum(Long parentEmpNum) 
    {
        this.parentEmpNum = parentEmpNum;
    }

    public Long getParentEmpNum() 
    {
        return parentEmpNum;
    }
    public void setParentAdNum(String parentAdNum) 
    {
        this.parentAdNum = parentAdNum;
    }

    public String getParentAdNum() 
    {
        return parentAdNum;
    }
    public void setUnitId(Long unitId) 
    {
        this.unitId = unitId;
    }

    public Long getUnitId() 
    {
        return unitId;
    }
    public void setOrgId(Long orgId)
    {
        this.orgId = orgId;
    }

    public Long getOrgId()
    {
        return orgId;
    }
    public void setPostId(Long postId) 
    {
        this.postId = postId;
    }

    public Long getPostId() 
    {
        return postId;
    }
    public void setStdPostId(Long stdPostId) 
    {
        this.stdPostId = stdPostId;
    }

    public Long getStdPostId() 
    {
        return stdPostId;
    }
    public void setPostLine(Integer postLine)
    {
        this.postLine = postLine;
    }

    public Integer getPostLine()
    {
        return postLine;
    }
    public void setMgmtLine(String mgmtLine) 
    {
        this.mgmtLine = mgmtLine;
    }

    public String getMgmtLine() 
    {
        return mgmtLine;
    }
    public void setProbation(Long probation) 
    {
        this.probation = probation;
    }

    public Long getProbation() 
    {
        return probation;
    }
    public void setPositiveDate(Date positiveDate) 
    {
        this.positiveDate = positiveDate;
    }

    public Date getPositiveDate() 
    {
        return positiveDate;
    }

    public void setTs(Date ts)
    {
        this.ts = ts;
    }

    public Date getTs()
    {
        return ts;
    }

    public void setUserType(String userType) 
    {
        this.userType = userType;
    }

    public String getUserType() 
    {
        return userType;
    }
    public void setAvatar(String avatar) 
    {
        this.avatar = avatar;
    }

    public String getAvatar() 
    {
        return avatar;
    }
    public void setPassword(String password) 
    {
        this.password = password;
    }

    public String getPassword() 
    {
        return password;
    }
    public void setLoginIp(String loginIp) 
    {
        this.loginIp = loginIp;
    }

    public String getLoginIp() 
    {
        return loginIp;
    }
    public void setLoginDate(Date loginDate) 
    {
        this.loginDate = loginDate;
    }

    public Date getLoginDate() 
    {
        return loginDate;
    }

    public SysOrg getOrg()
    {
        return org;
    }

    public void setOrg(SysOrg org)
    {
        this.org = org;
    }

    public List<SysRole> getRoles()
    {
        return roles;
    }

    public void setRoles(List<SysRole> roles)
    {
        this.roles = roles;
    }

    public Long[] getRoleIds()
    {
        return roleIds;
    }

    public void setRoleIds(Long[] roleIds)
    {
        this.roleIds = roleIds;
    }

    public Long[] getPostIds()
    {
        return postIds;
    }

    public void setPostIds(Long[] postIds)
    {
        this.postIds = postIds;
    }

    public Long getRoleId()
    {
        return roleId;
    }

    public void setRoleId(Long roleId)
    {
        this.roleId = roleId;
    }

    public Long getMsgId() {
        return msgId;
    }

    public void setMsgId(Long msgId) {
        this.msgId = msgId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getInner() {
        return inner;
    }

    public void setInner(Integer inner) {
        this.inner = inner;
    }

    public Set<String> getOrgBusinessIds() {
        return orgBusinessIds;
    }

    public void setOrgBusinessIds(Set<String> orgBusinessIds) {
        this.orgBusinessIds = orgBusinessIds;
    }

    public List<String> getAdNumList() {
        return adNumList;
    }

    public void setAdNumList(List<String> adNumList) {
        this.adNumList = adNumList;
    }

    public List<String> getNameList() {
        return nameList;
    }

    public void setNameList(List<String> nameList) {
        this.nameList = nameList;
    }

    public List<String> getIcNumList() {
        return icNumList;
    }

    public void setIcNumList(List<String> icNumList) {
        this.icNumList = icNumList;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("empNum", getEmpNum())
                .append("adNum", getAdNum())
                .append("empName", getEmpName())
                .append("icType", getIcType())
            .append("icNum", getIcNum())
            .append("phn", getPhn())
            .append("email", getEmail())
            .append("gender", getGender())
            .append("birthday", getBirthday())
            .append("postLv", getPostLv())
            .append("postGrade", getPostGrade())
            .append("empStatus", getEmpStatus())
            .append("entryDate", getEntryDate())
            .append("regtDate", getRegtDate())
            .append("plate", getPlate())
            .append("empGroup", getEmpGroup())
            .append("empSubGroup", getEmpSubGroup())
            .append("parentEmpNum", getParentEmpNum())
            .append("parentAdNum", getParentAdNum())
            .append("unitId", getUnitId())
            .append("orgId", getOrgId())
            .append("postId", getPostId())
            .append("stdPostId", getStdPostId())
            .append("postLine", getPostLine())
            .append("mgmtLine", getMgmtLine())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .append("probation", getProbation())
            .append("positiveDate", getPositiveDate())
            .append("status", getStatus())
            .append("createBy", getCreateBy())
            .append("createName", getCreateName())
            .append("updateBy", getUpdateBy())
            .append("updateName", getUpdateName())
            .append("dr", getDr())
            .append("ts", getTs())
            .append("version", getVersion())
            .append("userType", getUserType())
            .append("avatar", getAvatar())
            .append("password", getPassword())
            .append("loginIp", getLoginIp())
            .append("loginDate", getLoginDate())
            .toString();
    }
}
